package com.ds.infra.rpc.example.api.exception;

/**
 * 错误码枚举
 */
public enum ErrorCode {
    // 商品相关错误
    PRODUCT_NOT_FOUND("P001", "商品不存在"),
    PRODUCT_STOCK_INSUFFICIENT("P002", "商品库存不足"),

    // 订单相关错误
    ORDER_NOT_FOUND("O001", "订单不存在"),
    ORDER_CREATE_FAILED("O002", "订单创建失败"),
    ORDER_CANCEL_FAILED("O003", "订单取消失败"),

    // 系统错误
    SYSTEM_ERROR("S001", "系统错误"),
    PARAMETER_INVALID("S002", "参数无效"),
    REMOTE_SERVICE_ERROR("S003", "远程服务调用失败");

    private final String code;
    private final String message;

    ErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
